import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();

        int ret = 0;
        for (int i = 1; i < n; i++) {
//            System.out.println(i);
            if (method(i)) {
                ret++;
            }
        }

        System.out.println(ret);

        scanner.close();
    }

    public static boolean method(int num) {
        int count = 0;
        while (num > 0) {
            int x = num % 10;
            if (count % 2 == 0) { //奇数位
                if (x % 2 == 0) {
                    return false;
                }
            } else { //偶数位
                if (x % 2 != 0) {
                    return false;
                }
            }
            count++;
            num /= 10;
        }
        return true;
    }
}
